extends InputClass



func _ready() -> void:
	Input.joy_connection_changed.connect(joy_connection_changed)





func _unhandled_input(event: InputEvent) -> void:
	store_button_event(event) #必须最先执行
	
	
	#单人游戏和局域网游戏可以切换输入设备
	if event is InputEventKey or event is InputEventJoypadButton or event is InputEventJoypadMotion and event.is_pressed():
		var player: Player
		match Game.current_type:
			Game.GameType.SINGLE:
				player = get_tree().get_first_node_in_group("player")
			Game.GameType.WLAN:
				player = Game.get_current_player()
			Game.GameType.MULTI_SAME_SCREEN:
				pass
		
		if player:
			if event is InputEventJoypadButton or event is InputEventJoypadMotion:
				player.device = "joy" + str(event.device) + "_"
			elif event is InputEventKey:
				player.device = "key_"








